package com.cheng.im.service.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.OAS_30) // 使用 OpenAPI 3.0 规范
                .apiInfo(new ApiInfoBuilder()
                        .title("API 文档") // 文档标题
                        .description("Cheng-IM项目 API 文档") // 文档描述
                        .version("1.0") // 版本号
                        .build())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.cheng.im.service")) // 扫描的包路径
                .paths(PathSelectors.any())
                .build();
    }
}
